﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.SweptVolume.CApSVUtilities
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using Tecnomatix.Engineering;


namespace DnProcessSimulateCommands.SweptVolume;

public class CApSVUtilities
{
  public const double MINIMAL_TIME_INTERVAL = 0.05;

  public static ITxLocatableObject getRootObject(ITxSweptVolumeHoldingObject svhObject)
  {
    ITxLocatableObject rootObject = (ITxLocatableObject) null;
    switch (svhObject)
    {
      case ITxRoboticOrderedCompoundOperation _:
        rootObject = (svhObject as ITxRoboticOrderedCompoundOperation).Robot as ITxLocatableObject;
        break;
      case TxObjectFlowOperation _:
        TxObjectFlowOperation objectFlowOperation = svhObject as TxObjectFlowOperation;
        try
        {
          rootObject = objectFlowOperation.SimulatedObject;
          break;
        }
        catch (TxPartHasNoAppearanceException ex)
        {
          rootObject = (ITxLocatableObject) null;
          break;
        }
      case ITxRoboticProgram _:
        rootObject = (svhObject as ITxRoboticProgram).Robot as ITxLocatableObject;
        break;
    }
    return rootObject;
  }
}
